﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using BindToolkit.DataAnnotations;

namespace WpfApplication2
{
   [CustomValidation(typeof(IntervalValidator), "Validate")]
    public class Interval
    {
        
        public Interval()
        { 

        }

        [DynamicRange(typeof(int), "Low of outer interval need to be less than Low of inner interval plus Margin",
            DynamicMaximum = "InnerInterval.Low", DynamicMaximumDelay = "Margin")]
        [Range(0, 100)] 
        [FormatError(ErrorMessageResourceType = typeof(MessagesDictionary), ErrorMessageResourceName = "WrongIntervalFormat")]
        [Display(ResourceType = typeof(MessagesDictionary), Name = "LowName")]
        public int Low { get; set; }
        [Range(0, 100)]
        [FormatError(ErrorMessageResourceType = typeof(MessagesDictionary), ErrorMessageResourceName = "WrongIntervalFormat")]
        [Display(ResourceType = typeof(MessagesDictionary), Name = "HighName")]
        public int High { get; set; }
        public int Margin { get; set; } 
        public Interval InnerInterval { get; set; }
        public Dictionary<string, object> OtherInfos  { get; set; }
    }
}
        
       

       